import {message} from "ant-design-vue";
import jumpHelper from "@/js/pageJumper";

export const timeCorrect = (wrongTime)=>{
    {
        const utcDate = new Date(wrongTime);
        const options = {
            timeZone: 'Asia/Shanghai',
            year: 'numeric',
            month: '2-digit',
            day: '2-digit',
            hour: '2-digit',
            minute: '2-digit',
        };
        const formattedDate = new Intl.DateTimeFormat('zh-CN', options)
            .formatToParts(utcDate)
            .map(({ type, value }) => (type === 'literal' && value === '-' ? ' ' : value))
            .join('');
        return formattedDate;
    }
}

export const tokenTimeOut = (msg)=>{
    message.error('登陆凭证过期，请重新登录，'+msg)
    jumpHelper.jumpToSign()
}